<?php
function getThDiv()
{
  global $pId, $thOnPage, $count, $dir, $thumbDir;
  $str = "";
  for($i = 0; $i < $thOnPage; $i++){
    $imgNo = $pId * $thOnPage + $i;
    if($imgNo >= $count) break;
    $imgName = $dir[$imgNo];
    $imgTag = "<img src='$thumbDir/$imgName' alt='$imgName' ";
    $imgTag .= "onclick='changeImg($imgNo);' style='cursor:pointer;'>";
    $str .= "$imgTag&nbsp;&nbsp;";
  }
  return $str;
}

function getImgDiv()
{
  global $dir, $iId, $imgDir;
  $imgName = $dir[$iId];
  $imgTag = "<img src=\"$imgDir/$imgName\" alt=\"$imgName\">";
  return $imgTag;
}
?>